@model ResultVM
@{
    ViewData["Title"] = "登录";
}

<div class="container-fluid">
    <div class="row">
        <div class="col-12 text-center">
            <div class="my-4">
                <a href="/">
                    <sl-animation name="jello" easing="ease-in-out" duration="5000" play>
                        <img src="/favicon.svg" alt="@AppTo.GetValue("Common:EnglishName")" />
                    </sl-animation>
                </a>
            </div>
            <h4 class="my-3">Sign in to @AppTo.GetValue("Common:EnglishName")</h4>
        </div>
        <div class="col-12">
            <div class="border rounded mx-auto p-4" style="max-width:20em">
                <form action="/account/login" method="post">
                    @Html.AntiForgeryToken()
                    <input type="hidden" name="remember" value="1" />

                    @if (!string.IsNullOrWhiteSpace(Model?.Msg))
                    {
                        <sl-alert class="mb-3" open variant="danger" duration="8000" closable>
                            <sl-icon slot="icon" name="info-circle"></sl-icon>
                            @Model?.Msg
                        </sl-alert>
                    }

                    <sl-input class="mb-3" type="text" required label="Username or email address" name="UserName" maxlength="50" placeholder="netnr@@netnr.com" autocomplete="off" clearable autofocus>
                        <sl-icon name="envelope" slot="prefix"></sl-icon>
                    </sl-input>
                    <sl-input class="mb-3" type="password" required label="Password" name="UserPwd" maxlength="20" placeholder="******" toggle-password autocomplete="off">
                        <sl-icon name="key" slot="prefix"></sl-icon>
                    </sl-input>

                    <sl-button style="width:100%" type="submit" variant="warning">Sign in</sl-button>
                </form>

                @if (AppTo.GetValue<bool>("OAuthLogin:enable"))
                {
                    <div class="pagination justify-content-center mt-3">
                        @foreach (var key in ThirdLoginService.OpenIdMap.Keys)
                        {
                            var loginType = key.ToString().ToLower();
                            var loginIcon = CommonService.StaticResourceLink("LoginPath", $"{loginType}.svg");

                            <a class="m-2" href="/account/auth/@loginType">
                                <img src="@loginIcon" style="height:1.8em" title="@key" />
                            </a>
                        }
                    </div>
                }
            </div>

            <div class="mt-4 text-center pt-4">
                <a class="mx-2" href="/mix/terms">Terms</a>
                <a class="mx-2" href="https://zme.ink">Contact</a>
                |
                <a class="mx-2" href="/">Home</a>
                <a class="mx-2" href="/account/register">Sign up</a>
            </div>
        </div>
    </div>
</div>